Ext.define("App.controller.School", {
    extend: "Ext.app.Controller",
    requires: ["App.view.school.TabPanel", "App.view.subject.Show"],
    config: {
        control: {
            "#schoolList": {
                itemtap: "onSchoolTap" 
            },
          
            
            
         
            //换回学校选择界面
            "#schoolBackButton": {
                tap: function() {
                    
                     Ext.getCmp("splashScreen").setActiveItem(Ext.getCmp("settingsForm"));                    
           
                
                    
                }
            },
            "#billSummaryBackButton": {
                tap: function() {                	
                	Ext.getCmp("splashScreen").setActiveItem(Ext.getCmp("schoolTabPanel"));
                }
            }
          
        }
    },
    onSchoolShow: function() {},
 
    
    onBillTap: function(b, a, d, c) {
   },
    
    onSchoolTap: function(a,b,c,d ) {
    	

    	var selectData=d.data;
   
    	         
    		if(!Ext.getCmp("schoolTabPanel")){    		
    			Ext.getCmp("splashScreen").setActiveItem({
    	            xclass: "App.view.school.TabPanel"
    	        });	    		
    		}
    		
    
    	        Ext.getCmp("schoolToolbar").setTitle(selectData.sname);
    	        Ext.getCmp("schoolBio").setData(selectData);  
    	        if(selectData.scores)
    	        	Ext.getStore("Scores").setData(selectData.scores); 
    	        else Ext.getStore("Scores").removeAll();
    	        if(selectData.subjects)
    	        	Ext.getStore("Subjects").setData(selectData.subjects);
    	        else Ext.getStore("Subjects").removeAll();
    	        
    	        
    	        if(selectData.teachers)
    	        	Ext.getStore("Teachers").setData(selectData.teachers);
    	        else Ext.getStore("Teachers").removeAll();
    	  
    	 //  Ext.getCmp("Teachers").setData(this.currentSchool.teachers);  
	        Ext.getCmp("splashScreen").setActiveItem(Ext.getCmp("schoolTabPanel"));
    	    
    	
    	//}

    }
});